package com.control.qct.businesssteward.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.control.qct.businesssteward.R;
import com.control.qct.businesssteward.model.BrandModel;
import com.control.qct.businesssteward.model.SubUnitsModel;

import java.util.List;

/**
 * Created by Administrator on 2017/12/19 0019.
 */

public class GoodsSubUnitsAdapter extends BaseQuickAdapter<SubUnitsModel, BaseViewHolder> {
    private int mPosition = -1;

    public GoodsSubUnitsAdapter(@Nullable List<SubUnitsModel> data) {
        super(R.layout.rv_goods_measure_unit_item, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, SubUnitsModel item) {
        holder.setText(R.id.tv_unit, item.getTitle());
        holder.setGone(R.id.iv_select, mPosition == holder.getAdapterPosition());
    }

    public void setPosition(int position) {
        mPosition = position;
        notifyDataSetChanged();
    }
}
